GameMaker Language: An In-Depth Guide by Benjamin Anderson

GameMaker Language: An In-Depth Guide by Benjamin Anderson

Author:Benjamin Anderson
Language: eng
Format: mobi
Publisher: HeartBeast Studios


You can set the state in almost the same way.

state=state.walk;

Executing the state will be done in exactly the same way. In the chapter on artificial intelligence, I go through a basic example of how you can use enums and states to create artificial intelligence for your enemies; if this section is a little confusing to you, be sure to check there for an in-game example.

Creating Pseudo-Objects using Arrays and Enums

While developing this book, I’ve been working on a method for creating arrays that are similar to objects. There are many situations in which you need to store some information in an organized way and access it later, but where creating an actual object in your game would be overkill, because the built-in objects in GameMaker come with a lot of extra baggage. Of course, it is possible to use ds_maps for this, but maps can become bloated and difficult to manage if you try to go three levels down (for example, if you try to access a map data structure that is nested inside another map data structure). I can simulate the three-level depth using a 2d array and a few enums. Let me show you what I mean:

enum base {

name=0,

hp=1,

att=2,

def=3,

spd=4

}



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.